package thread;

public class JoinTest {

	public static void main(String[] args) throws InterruptedException {
		
		Thread t = new Thread(){

			@Override
			public void run() {
				
				try {
					Thread.sleep(3000);
					System.out.println("子线程完毕");
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		};
		t.start();
		t.join(); //哪个线程条用join，哪个线程就会等t执行完才执行
		
		System.out.println("主线程完毕");
	}
}
